﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;
using Abp.AutoMapper;
using AutoMapper;
using FwProject.ShoppingMall.EventAdvertising;

namespace FwProject.EventAdvertising.Dto
{
    /// <summary>
    /// 秒杀dto
    /// </summary>
    [AutoMap(typeof(ShopSecondkill))]
    public class ShopSecondkillInput
    {
        /// <summary>
        /// 商品编号
        /// </summary>
        [Display(Name = "商品编号")]
        public Guid ShopProductId { get; set; }


        /// <summary>
        /// 秒杀价格
        /// </summary>
        [Display(Name = "秒杀价格")]
        public decimal SecondkillPrice { get; set; } = 0m;

        /// <summary>
        /// 秒杀总的仓库数量
        /// </summary>
        [Display(Name = "秒杀总的仓库数量")]
        public int SecondkillCount { get; set; }

        /// <summary>
        /// 每个订单最大购买数
        /// </summary>
        [Display(Name = "每个订单最大购买数")]
        public int SecondkillSingleCount { get; set; }

        /// <summary>
        /// 秒杀开始时间
        /// </summary>
        [Display(Name = "秒杀开始时间")]
        public DateTime SecondkillBeginTime { get; set; }

        /// <summary>
        /// 秒杀结束时间
        /// </summary>
        [Display(Name = "秒杀结束时间")]
        public DateTime SecondkillEndTime { get; set; }

        /// <summary>
        /// 秒杀标题
        /// </summary>
        [Required(ErrorMessage = "{0}不能为空")]
        [Display(Name = "秒杀标题")]
        public string SecondkillTitle { get; set; }
    }

    /// <summary>
    /// 后台管理-输入Dto
    /// </summary>
    [AutoMapTo(typeof(ShopSecondkill))]
    public class ShopSecondkillBackstageEnterDto
    {
        /// <summary>
        /// 秒杀标题
        /// </summary>
        [Required(ErrorMessage = "{0}不能为空")]
        [Display(Name = "秒杀标题")]
        public string SecondkillTitle { get; set; }

        /// <summary>
        /// 秒杀价格
        /// </summary>
        [Display(Name = "秒杀价格")]
        public decimal SecondkillPrice { get; set; } = 0m;

        /// <summary>
        /// 秒杀总的仓库数量
        /// </summary>
        [Display(Name = "仓库数量")]
        public int SecondkillCount { get; set; }

        /// <summary>
        /// 每个订单最大购买数
        /// </summary>
        [Display(Name = "最大购买数")]
        public int SecondkillSingleCount { get; set; }

        /// <summary>
        /// 时间范围
        /// </summary>
        [IgnoreMap]
        [Display(Name = "时间范围")]
        public string SecondkillDateRange { get; set; }

        ///// <summary>
        ///// 秒杀开始时间
        ///// </summary>
        //[Display(Name = "秒杀开始时间")]
        //public DateTime SecondkillBeginTime { get; set; }
        ///// <summary>
        ///// 秒杀结束时间
        ///// </summary>
        //[Display(Name = "秒杀结束时间")]
        //public DateTime SecondkillEndTime { get; set; }


        /// <summary>
        /// 活动商品范围
        /// </summary>
        [IgnoreMap]
        public EventGoodsRange EventGoodsRange { get; set; } = EventGoodsRange.All;

        /// <summary>
        /// 商品Id
        /// </summary>
        [IgnoreMap]
        public List<Guid> ShopProductIds { get; set; }

    }

    public enum EventGoodsRange : byte
    {
        [Display(Name = "全部商品")]
        All,
        [Display(Name = "部分商品")]
        Part
    }
}
